package com.htsoft.test.admin;

import java.math.BigDecimal;
import java.util.List;

import javax.annotation.Resource;

import org.junit.Test;
import org.springframework.test.annotation.Rollback;

import com.google.gson.Gson;
import com.htsoft.oa.dao.admin.BookDao;
import com.htsoft.oa.model.admin.Book;
import com.htsoft.test.HtBaseTestCase;

public class BookDaoTestCase extends HtBaseTestCase
{

  @Resource
  private BookDao bookDao;

  @Test
  @Rollback(true)
  public void add()
  {
    Book book = new Book();
    book.setAuthor("作者");
    book.setIsbn("序列号");
    book.setBookName("书名");
    book.setPrice(new BigDecimal(10));
    book.setLocation("地址");
    book.setDepartment("部门");
    this.bookDao.save(book); }

  @Test
  public void Testt() {
    List list = this.bookDao.getAll();
    Gson gson = new Gson();
    System.out.println(gson.toJson(list));
  }
}